package com.fcscs.cservice.gwt.client;

import java.util.Date;
import java.util.List;

import com.fcscs.core.common.SearchResultsContainer;
import com.fcscs.cservice.domain.model.CheckInConfiguration;
import com.fcscs.cservice.domain.model.CheckOutConfiguration;
import com.fcscs.cservice.domain.model.FolioView;
import com.fcscs.cservice.domain.model.MessageIdAndStatus;
import com.fcscs.cservice.domain.model.MessageView;
import com.fcscs.cservice.domain.model.RCView;
import com.fcscs.cservice.domain.model.ReservationConf;
import com.fcscs.cservice.domain.model.ReservationView;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("../gwt/reservation")
public interface ReservationService extends RemoteService {

	/**
	 * find reservations (simple search)
	 * @param term term to search in first name, last name, confirmation no
	 * @param rsvStatusId reservation status id
	 * @param startTime start time
	 * @param endTime end time
	 * @param start 0 based start index
	 * @param resultCnt max result count limit
	 * @return
	 */
	SearchResultsContainer<ReservationView> findReservations(String term, Long rsvStatusId, Date startTime, Date endTime,
			int start, int resultCnt);
	/**
	 * find reservations (advanced search)
	 * @param firstName guest first name
	 * @param lastName guest last name
	 * @param rsvStatus reservation status id
	 * @param roomNo room no
	 * @param memberNo membership no
	 * @param roomStatus room status id
	 * @param baggageNo baggage no
	 * @param arrivDate arrival date
	 * @param departDate departure date
	 * @param eta expected arrival time
	 * @param etd expected departure time
	 * @param date today
	 * @param start 0 based start index
	 * @param resultCnt max result count limit
	 * @return
	 */
	SearchResultsContainer<ReservationView> findReservations(String firstName, String lastName, Long rsvStatus, String roomNo, 
			String memberNo, Long roomStatus, String baggageNo, Date arrivDate, Date departDate, Date eta, Date etd, Date date,
			int start, int resultCnt);


	/**
	 * search reservations for folio page
	 * @param firstName guest first name
	 * @param lastName guest last name
	 * @param rsvStatusId reservation status id
	 * @param roomNo room no
	 * @param arrivStart arrival start date (time should be 00:00:00 at client end)
	 * @param arrivEnd arrival end date (time should be 23:59:59 at client end)
	 * @param departStart departure start date (time should be 00:00:00 at client end)
	 * @param departEnd departure end date (time should be 23:59:59 at client end)
	 * @param date current day (time should be 00:00:00 at client end)
	 * @param start 0 based start index
	 * @param resultCnt max result count limit
	 * @return
	 */
	SearchResultsContainer<ReservationView> findRsvForFolio(String firstName, String lastName, Long rsvStatusId, String roomNo,
			Date arrivStart, Date arrivEnd, Date departStart, Date departEnd, Date date, int start, int resultCnt);

	/**
	 * get ReservationView by id
	 * @param id
	 * @return
	 */
	ReservationView getReservationView(long id);

	/**
	 * get RCView by id
	 * @param id
	 * @return
	 */
	RCView getRCView(long id);

	/**
	 * update rc content
	 * @param rc rc to be updated
	 * @return
	 */
	RCView updateRC(RCView rc);
	
	/**
	 * get folio by id
	 * @param id
	 * @return
	 */
	FolioView getFolioView(long id);

	/**
	 * get all messages of a reservation
	 * @param rsvId reservation id
	 * @return
	 */
	List<MessageView> getMessages(long rsvId);

	/**
	 * update message isRead status
	 * @param messageList
	 * @return
	 */
	List<MessageIdAndStatus> updateMessages(List<MessageIdAndStatus> messageList);

	/**
	 * process an express check in
	 * @param rsvId reservation id
	 * @param rc rc with guest signature
	 * @return
	 */
	boolean expressCheckIn(long rsvId, RCView rc);

	/**
	 * process check out
	 * @param rsvId reservation id
	 * @param folio folio with guest signature
	 * @param isAuto true: auto check out; false: manual check out
	 * @return
	 */
	boolean checkOut(long rsvId, FolioView folio, boolean isAuto);

	/**
	 * send a copy of folio after successfully auto checked out
	 * @param rsvId reservation id
	 * @param folioId folio id
	 * @return
	 */
	boolean sendEFolio(long rsvId, long folioId);

	ReservationConf getRsvConf(long propId);

	ReservationConf saveRsvConf(ReservationConf conf);

	CheckInConfiguration getCheckInConf(long propId);



	CheckOutConfiguration getCheckOutConf(long propId);

	CheckOutConfiguration saveCheckOutConf(CheckOutConfiguration conf);
}
